{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/yaoxiaoying/.py3virtualEnv/ai/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 216, got 192\n",
      "  return f(*args, **kwds)\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "from sklearn.preprocessing import StandardScaler\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.decomposition import PCA\n",
    "from matplotlib.colors import ListedColormap\n",
    "from sklearn.linear_model import LogisticRegression"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 数据获取"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 读取数据（）\n",
    "df_wine = pd.read_csv('wine.data',header=None)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "该数据集是UCI的公开数据集，是对意大利同一地区种植的葡萄酒进行分析的结果，数据集共14列数据，第一个属性是类标识符，分别是1/2/3来表示，代表葡萄酒的三个分类。剩余的13个属性是，酒精、苹果酸、灰、灰分的碱度、镁、总酚、黄酮类化合物、非黄烷类酚类、原花色素、颜色强度、色调等。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 设置列索引\n",
    "df_wine.columns =  ['Class label', 'Alcohol', 'Malic acid', 'Ash',\n",
    "                   'Alcalinity of ash', 'Magnesium', 'Total phenols',\n",
    "                   'Flavanoids', 'Nonflavanoid phenols', 'Proanthocyanins',\n",
    "                   'Color intensity', 'Hue',\n",
    "                   'OD280/OD315 of diluted wines', 'Proline']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(178, 14)"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 数据维度\n",
    "df_wine.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2    71\n",
       "1    59\n",
       "3    48\n",
       "Name: Class label, dtype: int64"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 每一类数据包含的样本个数\n",
    "df_wine['Class label'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Class label</th>\n",
       "      <th>Alcohol</th>\n",
       "      <th>Malic acid</th>\n",
       "      <th>Ash</th>\n",
       "      <th>Alcalinity of ash</th>\n",
       "      <th>Magnesium</th>\n",
       "      <th>Total phenols</th>\n",
       "      <th>Flavanoids</th>\n",
       "      <th>Nonflavanoid phenols</th>\n",
       "      <th>Proanthocyanins</th>\n",
       "      <th>Color intensity</th>\n",
       "      <th>Hue</th>\n",
       "      <th>OD280/OD315 of diluted wines</th>\n",
       "      <th>Proline</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>14.23</td>\n",
       "      <td>1.71</td>\n",
       "      <td>2.43</td>\n",
       "      <td>15.6</td>\n",
       "      <td>127</td>\n",
       "      <td>2.80</td>\n",
       "      <td>3.06</td>\n",
       "      <td>0.28</td>\n",
       "      <td>2.29</td>\n",
       "      <td>5.64</td>\n",
       "      <td>1.04</td>\n",
       "      <td>3.92</td>\n",
       "      <td>1065</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>13.20</td>\n",
       "      <td>1.78</td>\n",
       "      <td>2.14</td>\n",
       "      <td>11.2</td>\n",
       "      <td>100</td>\n",
       "      <td>2.65</td>\n",
       "      <td>2.76</td>\n",
       "      <td>0.26</td>\n",
       "      <td>1.28</td>\n",
       "      <td>4.38</td>\n",
       "      <td>1.05</td>\n",
       "      <td>3.40</td>\n",
       "      <td>1050</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>13.16</td>\n",
       "      <td>2.36</td>\n",
       "      <td>2.67</td>\n",
       "      <td>18.6</td>\n",
       "      <td>101</td>\n",
       "      <td>2.80</td>\n",
       "      <td>3.24</td>\n",
       "      <td>0.30</td>\n",
       "      <td>2.81</td>\n",
       "      <td>5.68</td>\n",
       "      <td>1.03</td>\n",
       "      <td>3.17</td>\n",
       "      <td>1185</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>14.37</td>\n",
       "      <td>1.95</td>\n",
       "      <td>2.50</td>\n",
       "      <td>16.8</td>\n",
       "      <td>113</td>\n",
       "      <td>3.85</td>\n",
       "      <td>3.49</td>\n",
       "      <td>0.24</td>\n",
       "      <td>2.18</td>\n",
       "      <td>7.80</td>\n",
       "      <td>0.86</td>\n",
       "      <td>3.45</td>\n",
       "      <td>1480</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>13.24</td>\n",
       "      <td>2.59</td>\n",
       "      <td>2.87</td>\n",
       "      <td>21.0</td>\n",
       "      <td>118</td>\n",
       "      <td>2.80</td>\n",
       "      <td>2.69</td>\n",
       "      <td>0.39</td>\n",
       "      <td>1.82</td>\n",
       "      <td>4.32</td>\n",
       "      <td>1.04</td>\n",
       "      <td>2.93</td>\n",
       "      <td>735</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Class label  Alcohol  Malic acid   Ash  Alcalinity of ash  Magnesium  \\\n",
       "0            1    14.23        1.71  2.43               15.6        127   \n",
       "1            1    13.20        1.78  2.14               11.2        100   \n",
       "2            1    13.16        2.36  2.67               18.6        101   \n",
       "3            1    14.37        1.95  2.50               16.8        113   \n",
       "4            1    13.24        2.59  2.87               21.0        118   \n",
       "\n",
       "   Total phenols  Flavanoids  Nonflavanoid phenols  Proanthocyanins  \\\n",
       "0           2.80        3.06                  0.28             2.29   \n",
       "1           2.65        2.76                  0.26             1.28   \n",
       "2           2.80        3.24                  0.30             2.81   \n",
       "3           3.85        3.49                  0.24             2.18   \n",
       "4           2.80        2.69                  0.39             1.82   \n",
       "\n",
       "   Color intensity   Hue  OD280/OD315 of diluted wines  Proline  \n",
       "0             5.64  1.04                          3.92     1065  \n",
       "1             4.38  1.05                          3.40     1050  \n",
       "2             5.68  1.03                          3.17     1185  \n",
       "3             7.80  0.86                          3.45     1480  \n",
       "4             4.32  1.04                          2.93      735  "
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_wine.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 数据集划分"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 数据集设置：X为样本特征数据，y为目标数据，即标注结果\n",
    "X, y = df_wine.iloc[:, 1:].values, df_wine.iloc[:, 0].values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 数据集划分： 将数据集划分为训练集和测试集数据（测试集数据为30%，训练集为70%）\n",
    "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3,\n",
    "                                                    stratify=y,\n",
    "                                                    random_state=0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 数据标准化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 实例化\n",
    "sc = StandardScaler()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 对数据集进行标准化（一般情况下我们在训练集中进行均值和方差的计算，直接在测试集中使用）\n",
    "X_train_std = sc.fit_transform(X_train)\n",
    "X_test_std = sc.transform(X_test)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# PCA(Pricipal component analysis)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PCA实现"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 特征值计算"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 计算协方差矩阵\n",
    "cov_mat = np.cov(X_train_std.T)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 对协方差矩阵进行特征值分解\n",
    "eigen_vals, eigen_vecs = np.linalg.eig(cov_mat)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([4.84274532, 2.41602459, 1.54845825, 0.96120438, 0.84166161,\n",
       "       0.6620634 , 0.51828472, 0.34650377, 0.3131368 , 0.10754642,\n",
       "       0.21357215, 0.15362835, 0.1808613 ])"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 特征值\n",
    "eigen_vals"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 特征值分布"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 特征值之和\n",
    "tot = sum(eigen_vals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 对特征进行排序，并计算所占的比例\n",
    "var_exp = [(i / tot) for i in sorted(eigen_vals, reverse=True)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 累计求和\n",
    "cum_var_exp = np.cumsum(var_exp)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAEYCAYAAAAJeGK1AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAdPUlEQVR4nO3de3hU9b3v8feXgAkXQYhBo4BIUbmIoDtaEVQIoFWDHuzxSLsVtFLFFrUoskXo2V4fH1tadW91V6yt0iP1CkVxe0HQCkhVKBjReIGtaBBKuEYqRC7f88csYoiBmSSzMmtmPq/n8cmamd/MfNdY59PfWmu+P3N3REREoqZZqgsQERGpiwJKREQiSQElIiKRpIASEZFIUkCJiEgkNU91AfVx6KGHeteuXVNdhoiINMLSpUs3uHtBvHFpFVBdu3ZlyZIlqS5DREQawcxWJzJOh/hERCSSFFAiIhJJCigREYmktDoHVZedO3dSXl7Ojh07Ul1KxsjLy6NTp060aNEi1aWISBZL+4AqLy/n4IMPpmvXrphZqstJe+7Oxo0bKS8v5+ijj051OSKSxdL+EN+OHTvIz89XOCWJmZGfn68ZqYikXNoHFKBwSjJ9niISBaEGlJm1MLPnD/B4npnNMbN3zexPpm9GEREJhBZQZtYS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u38znQ092HBfe/vndMTe5+TdOVLxJ9mkGJNMxA4N+AlcCvzOyPZjYf6GJmy81sITAU+BWxNjWLzWxmzReo45Df6zW2LzOz35jZX82szMx6B0sWzAwa144MxrUys2eC5TMeCO67wMweMrNcM1tqZmnfk06ykwJKpGH+H7AE2E2src5P3b046Nq8ELgUeAp4Elju7hv5tk9cx+AQ34tmlnOA9+hPbImCW4ALgBHAF0Hj2jXBmCuBFcHyGYVmdoK7zwYOA/4DeNDdNyVrp0Wakg7xiTRMS+Au4DRiSztMMbPTAQeOA04k1nl6EbB3zaW9bVvW13WIrw4z3P0bM/tH8BrdiHWBBtjbcuk44DQzGwQcQqyZbSnwO2LhqMOGkrYUUCIN9wKxc0u/NbP2wEZ3/08zux+Y6u6fmdmhQEOb5m6rdXs13zauPQlYTKzT+tvu/kczuwD4wsyaAROB/wLGA3c38P1FUkqH+EQawN3L3P31Grc3A8cH4VCTEVu5ez5wXHBor3twNd+8YJ2fRM0EjgnOb3UP7nsYONfM3iR2uO9z4Grgr8Bk4AIzO7oBuyiScmoWK9IIZvYycL67VwW3pxBb8uGc4PLzTsD97v6/UlmnSDpSQImISCTpEJ+IiESSAkpERCJJASUiIpGkgBIRkUhSQImISCT9fxCD3JB34YagAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 绘制图像\n",
    "plt.figure()\n",
    "plt.bar(range(1, 14), var_exp, alpha=0.5, align='center',\n",
    "        label='特征值分布')\n",
    "plt.step(range(1, 14), cum_var_exp, where='mid',\n",
    "         label='累计特征值')\n",
    "plt.ylabel('特征值比例')\n",
    "plt.xlabel('特征index')\n",
    "plt.legend(loc='best')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 特征降维"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 创建列表，由(eigenvalue, eigenvector)元组构成\n",
    "eigen_pairs = [(np.abs(eigen_vals[i]), eigen_vecs[:, i])\n",
    "               for i in range(len(eigen_vals))]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 按特征值从大到小对列表(eigenvalue, eigenvector)排序\n",
    "eigen_pairs.sort(key=lambda k: k[0], reverse=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[(4.842745315655898,\n",
       "  array([-0.13724218,  0.24724326, -0.02545159,  0.20694508, -0.15436582,\n",
       "         -0.39376952, -0.41735106,  0.30572896, -0.30668347,  0.07554066,\n",
       "         -0.32613263, -0.36861022, -0.29669651])),\n",
       " (2.4160245870352255,\n",
       "  array([ 0.50303478,  0.16487119,  0.24456476, -0.11352904,  0.28974518,\n",
       "          0.05080104, -0.02287338,  0.09048885,  0.00835233,  0.54977581,\n",
       "         -0.20716433, -0.24902536,  0.38022942])),\n",
       " (1.5484582488203513,\n",
       "  array([-0.13774873,  0.09615039,  0.67777567,  0.62504055,  0.19613548,\n",
       "          0.14031057,  0.11705386,  0.13121778,  0.0304309 , -0.07992997,\n",
       "          0.05305915,  0.13239103, -0.07065022])),\n",
       " (0.9612043774977367,\n",
       "  array([-0.0032961 ,  0.56264669, -0.10897711,  0.0338187 , -0.36751107,\n",
       "          0.24024513,  0.1870533 , -0.02292622,  0.49626233,  0.10648294,\n",
       "         -0.36905375,  0.14201609, -0.16768217])),\n",
       " (0.8416616104578422,\n",
       "  array([-0.29062523,  0.08953787, -0.16083499,  0.05158734,  0.67648707,\n",
       "         -0.11851114, -0.10710035, -0.50758161,  0.20163462,  0.00573607,\n",
       "         -0.27691422, -0.06662756, -0.12802904])),\n",
       " (0.6620634040383039,\n",
       "  array([ 2.99096847e-01,  6.27036396e-01,  3.89128239e-04, -4.05836452e-02,\n",
       "          6.57772614e-02, -5.89776247e-02, -3.01103180e-02, -2.71728086e-01,\n",
       "         -4.39997519e-01, -4.11743459e-01,  1.41673377e-01,  1.75842384e-01,\n",
       "          1.38018388e-01])),\n",
       " (0.5182847213561953,\n",
       "  array([ 0.07905293, -0.27400201,  0.13232805,  0.2239991 , -0.40526897,\n",
       "         -0.03474194,  0.04178357, -0.63114569, -0.32312277,  0.26908262,\n",
       "         -0.30264066,  0.13054014,  0.00081134])),\n",
       " (0.34650376641286657,\n",
       "  array([-0.36817641, -0.01257758,  0.17757818, -0.44059211,  0.1166175 ,\n",
       "          0.35019213,  0.21871818,  0.19712942, -0.43305587, -0.06684118,\n",
       "         -0.45976229,  0.11082755,  0.00560817])),\n",
       " (0.3131368004720887,\n",
       "  array([-0.39837702,  0.11045823,  0.38249686, -0.24337385, -0.25898236,\n",
       "         -0.34231286, -0.03612316, -0.17143688,  0.24437021, -0.15551492,\n",
       "          0.02119612, -0.23808956,  0.51727846])),\n",
       " (0.2135721466052733,\n",
       "  array([ 0.37463888, -0.1374056 ,  0.46158303, -0.41895399,  0.01004706,\n",
       "         -0.22125424, -0.04175136, -0.08875695,  0.19992186, -0.22166887,\n",
       "         -0.09846946,  0.01912058, -0.54253207])),\n",
       " (0.18086130479496634,\n",
       "  array([ 0.26283426, -0.26676921, -0.11554255,  0.19948341,  0.02890188,\n",
       "         -0.06638686, -0.21334908,  0.18639128,  0.16808299, -0.46636903,\n",
       "         -0.53248388,  0.23783528,  0.36776336])),\n",
       " (0.15362835006711043,\n",
       "  array([-0.12783451,  0.08064016,  0.01679249, -0.11084566,  0.07938796,\n",
       "         -0.49145931, -0.0503074 ,  0.17532803, -0.00367596,  0.35975654,\n",
       "          0.04046698,  0.74222954,  0.03873952])),\n",
       " (0.10754642369670996,\n",
       "  array([-0.09448698,  0.02636524,  0.14274751, -0.13048578, -0.06760808,\n",
       "          0.45991766, -0.81458395, -0.09574809,  0.06724689,  0.08733362,\n",
       "          0.12906113,  0.18764627,  0.01211126]))]"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 特征值与特征向量\n",
    "eigen_pairs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 取前两个特征值对应的特征向量作为主要成分\n",
    "w = np.hstack((eigen_pairs[0][1][:, np.newaxis],\n",
    "               eigen_pairs[1][1][:, np.newaxis]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[-0.13724218,  0.50303478],\n",
       "       [ 0.24724326,  0.16487119],\n",
       "       [-0.02545159,  0.24456476],\n",
       "       [ 0.20694508, -0.11352904],\n",
       "       [-0.15436582,  0.28974518],\n",
       "       [-0.39376952,  0.05080104],\n",
       "       [-0.41735106, -0.02287338],\n",
       "       [ 0.30572896,  0.09048885],\n",
       "       [-0.30668347,  0.00835233],\n",
       "       [ 0.07554066,  0.54977581],\n",
       "       [-0.32613263, -0.20716433],\n",
       "       [-0.36861022, -0.24902536],\n",
       "       [-0.29669651,  0.38022942]])"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "w"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0.71225893,  2.22048673, -0.13025864,  0.05962872, -0.50432733,\n",
       "       -0.52831584, -1.24000033,  0.84118003, -1.05215112, -0.29218864,\n",
       "       -0.20017028, -0.82164144, -0.62946362])"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 原始特征（以第一个样本为例）\n",
    "X_train_std[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([2.38299011, 0.45458499])"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 特征压缩后结果\n",
    "X_train_std[0].dot(w)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 全部特征压缩\n",
    "X_train_pca = X_train_std.dot(w)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAEYCAYAAAAJeGK1AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3db4xc13nf8d9DigrJiFy5NC3JUnfXhlTHLyQT4Na2LAWFxMRyk1C1gwoowrSWiWJb2C2XlNsYDVFxjYAF+scyaTcqShRMBGWTFkpkg3IE0wql1BVtKV4CtATIUCOoXEEGoa4Zi7RKyiJ3n76YHXFmeGfmzsz9c8693w8w4M7lzNwzw+V95pzznOeYuwsAgNCsKrsBAAAkIUABAIJEgAIABIkABQAIEgEKABCkq8puQKf3vve9Pjk5WXYzAAAFOXHixE/cfXPn8eAC1OTkpObn58tuBgCgIGa2kHScIT4AQJAIUACAIBGgAABBIkABAIJEgAIABIkABQAIEgEKABAkAhQAIEgEKABAkAhQALqae3FOkwcmterLqzR5YFJzL86V3STUSHCljgCEYe7FOU0/Ma3zF89LkhbOLmj6iWlJ0o5bd5TZNNQEPSgAifYe2/tucGo6f/G89h7bW1KLUDcEKACJXjv72kDHgawRoAAkGh8bH+g4kDUCFIBE+7ft1/o169uOrV+zXvu37S+pRagbAhSARDtu3aFD2w9pYmxCJtPE2IQObT9EggQKY+5edhvaTE1NORsWAkB9mNkJd5/qPE4PCgAQJAIUACBIBCgAQJAKCVBmdpWZPWZmx83scBHnBADErage1Kcl/dDd75B0g5ltKei8AIBIFVWL79uSnjSzqyRdK+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nV34+J+lDJbYlOu7+15LE795wzOy3JP1QEVz/ahGg3P3zrffN7I8lbZN0j6QPmdm/cPf/XErjItH5GUqSmd0raUbSdndfKr5V0fqJpLGVn8cUTj20aPC7N5LfkDSuCK5/tV4HZWaTkv6bu/9KyU2JjpldL+kxSZ9y9/9XdntiYmY7JX3M3f+Zmf25pK+6e9CT1SHhdy8bMVz/6jwHhdF8VtINko6a2bMrF12kMyfpRjN7QdLfSDpWcntiw+9eTdS6BwUACBc9KABAkAhQAIAgEaAAAEEiQAEAgkSAAnJmZrNm9rKZfc/MnjGz968c/z0ze36lntyGHs9fY2ZPFNdiIAwEKKAYv+fun5B0WNK/NLNPSPplSR+X9G1J00lPMrN1kk6Ien2oIQIUUKxrJV1QYxX/k95Y5/FtSf876cHufsHdb5P0enFNBMJAgAKKsWREJTUAAACHSURBVNfMvqtGj+mgpOvUWKQrd3/V3RnCAzrUohYfEID97v5HzTtmdk7SNSs/f1TS33P3/1hW44AQ0YMCynFcjWE+qbHdxoUS2wIEiR4UUI4jkn7FzP5Kjf2N/lHJ7QGCQy0+AECQGOIDAASJAAUACBIBCgAQJAIUACBIBCgAQJAIUACAIP1/5yPRwKPgSQ8AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 特征压缩后结果展示\n",
    "colors = ['r', 'b', 'g']\n",
    "markers = ['s', 'x', 'o']\n",
    "\n",
    "for l, c, m in zip(np.unique(y_train), colors, markers):\n",
    "    # 按照样本的真实值进行展示\n",
    "    plt.scatter(X_train_pca[y_train == l, 0], \n",
    "                X_train_pca[y_train == l, 1], \n",
    "                c=c, label=l, marker=m)\n",
    "\n",
    "plt.xlabel('PC 1')\n",
    "plt.ylabel('PC 2')\n",
    "plt.legend(loc='lower left')\n",
    "plt.tight_layout()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 使用sklearn实现PCA"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "sklearn中提供了进行PCA的API"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 特征值计算"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 实例化pca，保留所有特征\n",
    "pca = PCA()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.36951469, 0.18434927, 0.11815159, 0.07334252, 0.06422108,\n",
       "       0.05051724, 0.03954654, 0.02643918, 0.02389319, 0.01629614,\n",
       "       0.01380021, 0.01172226, 0.00820609])"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 特征提取\n",
    "X_train_pca = pca.fit_transform(X_train_std)\n",
    "# 特征值结果\n",
    "pca.explained_variance_ratio_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.legend.Legend at 0x131ba9550>"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAEDCAYAAAA1CHOzAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAc1ElEQVR4nO3de3hU9b3v8ffXAAkXiRBAIheBYuUigu54QUAhgFYNurHHI3ULaKWgFmpRZEvBs70+fWhple1lV+xF8EgVFYrioYqgFZCiUi4iAQUVDUK5E6gQCHzPH7MSQkzIJM6aySSf1/P0Yc3Mb1a+mTp8+P3WWt9l7o6IiMgpiS5ARESqBwWCiI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IiICKBAEBGRgAJBREQABYLUUmb2hpk1LPF4QRljZpjZmaV715hZnWToxyNSWQoEqVXMrLmZ/RQ44u7/MrPhZvY20MPM3jKzV4Jx9wAfEbmJ1PygOdsuM5sH/D/gzBL7fLwSP/9mM7s5lr+TSKxU6659IiHoCvxv4Awze8TdJwLTzWyeu+cAmFkmkfYKXwKd3X1g8Pw7RWNKcvcx8StfJDyaIUht0xv4T2Aj8Csz+5OZLQLamtkqM1sCDAB+RaRVwTIzm11yB2UsIb1TYvtmM/uNmf3NzHLNrGvQjnh20GBvSDCugZm9HLS1fjJ47loze9rMUs1shZklVc8fSX4KBKlt/i/wIXCUSBuFn7h7dtAhcgkwFJgFvAiscvddHO/D0yJYMppvZikn+Rk9ibQfvh+4FhgMfBU02NsSjBkJrA3aWmea2bnuPhc4Hfhv4Cl33x2rX1okGloyktqmPvBL4BIirZgnmVkfwIGzgfOIdLNcChTde6Docv7tZS0ZlWGmux82s38G++hApOMkQFHrjLOBS8ysL3AakaZ7a4DfEQkjLUNJ3CkQpDZ6ncixgd+aWRNgl7s/bmZPAFPc/QszawZUtZHfgVKPN3O8wd75wDIiHVjfd/c/mdm1wFdmdgowHvgfYCwwuYo/X6RKtGQktYq757r7OyUe7wHOCf4yLsmI3D1xEXB2sFTUMTjbaGHQGz9as4GzguMTHYPnngGuMrP3iCwffQncDvwNmAhca2btq/ArilSZmttJrWRmbwDXuHtB8HgSkRbNVwano7YGnnD3f09knSLxpEAQERFAS0YiIhJQIIiICKBAEBGRgAJBREQABYKIiAT+P6WjxLo7RgzPAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 特征值绘制\n",
    "# 绘制图像\n",
    "plt.figure()\n",
    "plt.bar(range(1, 14), pca.explained_variance_ratio_, alpha=0.5, align='center',\n",
    "        label='特征值分布')\n",
    "plt.step(range(1, 14), np.cumsum(pca.explained_variance_ratio_), where='mid',\n",
    "         label='累计特征值')\n",
    "plt.ylabel('特征值比例')\n",
    "plt.xlabel('特征index')\n",
    "plt.legend(loc='best')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 特征降维"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 压缩到二维特征\n",
    "pca = PCA(n_components=2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 对训练数据进行处理\n",
    "X_train_pca = pca.fit_transform(X_train_std)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0.36951469 0.18434927]\n"
     ]
    }
   ],
   "source": [
    "# 特征值结果(只保留两个特征)\n",
    "print(pca.explained_variance_ratio_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 对测试集数据进行处理\n",
    "X_test_pca = pca.transform(X_test_std)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAEYCAYAAAAJeGK1AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3db4xc13nf8d9DigrJiFy5NC3JUnfXhlTHLyQT4Na2LAWFxMRyk1C1gwoowrSWiWJb2C2XlNsYDVFxjYAF+scyaTcqShRMBGWTFkpkg3IE0wql1BVtKV4CtATIUCOoXEEGoa4Zi7RKyiJ3n76YHXFmeGfmzsz9c8693w8w4M7lzNwzw+V95pzznOeYuwsAgNCsKrsBAAA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IUACBIBCgAQJAIUACAIP1/5yPRwKPgSQ8AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 特征降维后结果展示\n",
    "colors = ['r', 'b', 'g']\n",
    "markers = ['s', 'x', 'o']\n",
    "\n",
    "for l, c, m in zip(np.unique(y_train), colors, markers):\n",
    "    # 按照样本的真实值进行展示\n",
    "    plt.scatter(X_train_pca[y_train == l, 0], \n",
    "                X_train_pca[y_train == l, 1], \n",
    "                c=c, label=l, marker=m)\n",
    "\n",
    "plt.xlabel('PC 1')\n",
    "plt.ylabel('PC 2')\n",
    "plt.legend(loc='lower left')\n",
    "plt.tight_layout()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 利用逻辑回归进行分类"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 绘制函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 绘制样本及其目标值\n",
    "def plot_decision_regions(X, y, classifier, resolution=0.02):\n",
    "    \"\"\"\n",
    "    X:样本特征值\n",
    "    y:目标值\n",
    "    classifier: 分类器\n",
    "    \"\"\"\n",
    "    # 设置图像的标记及颜色\n",
    "    markers = ('s', 'x', 'o', '^', 'v')\n",
    "    colors = ('red', 'blue', 'lightgreen', 'gray', 'cyan')\n",
    "    cmap = ListedColormap(colors[:len(np.unique(y))])\n",
    "\n",
    "    # 利用样本点创建meshgrid\n",
    "    x1_min, x1_max = X[:, 0].min() - 1, X[:, 0].max() + 1\n",
    "    x2_min, x2_max = X[:, 1].min() - 1, X[:, 1].max() + 1\n",
    "    xx1, xx2 = np.meshgrid(np.arange(x1_min, x1_max, resolution),\n",
    "                           np.arange(x2_min, x2_max, resolution))\n",
    "    # 预测结果\n",
    "    Z = classifier.predict(np.array([xx1.ravel(), xx2.ravel()]).T)\n",
    "    Z = Z.reshape(xx1.shape)\n",
    "    # 绘制预测结果的等高线\n",
    "    plt.contourf(xx1, xx2, Z, alpha=0.4, cmap=cmap)\n",
    "    plt.xlim(xx1.min(), xx1.max())\n",
    "    plt.ylim(xx2.min(), xx2.max())\n",
    "\n",
    "    # 绘制样本点,并根据真实值进行着色\n",
    "    for idx, cl in enumerate(np.unique(y)):\n",
    "        # 绘制散点图\n",
    "        plt.scatter(x=X[y == cl, 0], \n",
    "                    y=X[y == cl, 1],\n",
    "                    alpha=0.6, \n",
    "                    c=cmap(idx),\n",
    "                    edgecolor='black',\n",
    "                    marker=markers[idx], \n",
    "                    label=cl)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### PCA特征降维"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 利用PCA进行特征降维(提取)\n",
    "# 保留两维特征\n",
    "pca = PCA(n_components=2)\n",
    "# 训练集数据处理\n",
    "X_train_pca = pca.fit_transform(X_train_std)\n",
    "# 测试集数据处理\n",
    "X_test_pca = pca.transform(X_test_std)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### LR分类器"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/yaoxiaoying/.py3virtualEnv/ai/lib/python3.7/site-packages/sklearn/linear_model/logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n",
      "  FutureWarning)\n",
      "/Users/yaoxiaoying/.py3virtualEnv/ai/lib/python3.7/site-packages/sklearn/linear_model/logistic.py:469: FutureWarning: Default multi_class will be changed to 'auto' in 0.22. Specify the multi_class option to silence this warning.\n",
      "  \"this warning.\", FutureWarning)\n"
     ]
    }
   ],
   "source": [
    "# 实例化\n",
    "lr = LogisticRegression()\n",
    "# 模型训练\n",
    "lr = lr.fit(X_train_pca, y_train)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 训练数据结果"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "'c' argument looks like a single numeric RGB or RGBA sequence, which should be avoided as value-mapping will have precedence in case its length matches with 'x' & 'y'.  Please use a 2-D array with a single row if you really want to specify the same RGB or RGBA value for all points.\n",
      "'c' argument looks like a single numeric RGB or RGBA sequence, which should be avoided as value-mapping will have precedence in case its length matches with 'x' & 'y'.  Please use a 2-D array with a single row if you really want to specify the same RGB or RGBA value for all points.\n",
      "'c' argument looks like a single numeric RGB or RGBA sequence, which should be avoided as value-mapping will have precedence in case its length matches with 'x' & 'y'.  Please use a 2-D array with a single row if you really want to specify the same RGB or RGBA value for all points.\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAEYCAYAAAAJeGK1AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3de5TW1X3v8feGARkEQZBxBHEUIaCswRteseRAbEKO12hdNpo2Rs+CnrSJMT1Nj0nbdVo97UlyuhLWyeVIGkNPNeqymEqKQlRMphBEBxUoN0GaAcEBnMhFh8sM7PPHb34zzzy3eS6/y/79ns9rLRczz8zz/PYM+Ps8e+/v3ttYaxEREXHNoLgbICIiko8CSkREnKSAEhERJymgRETESQooERFxUl3cDch21ogR9vyxY+Nuhkhodh8dzOkToH5QfdxNEXHC5jc2v2+tHZf9uHMBdf7YsbR+4xtxN0MkNA+uH8nVf2eYftr0uJsi4oQZw2a05XtcQ3wiIuIkBZSIiDhJASUiIk5SQIlE7KLnf8OO1oNxN0PEeZ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Kie5K6d9PadJ8/9EclITp88A5wApjzKqem7J4ngAmGGM2AL8FXo65PS7Sv58apx6UiIg4ST0oERFxkgJKREScpIASEREnKaBERMRJCiiRkBlj/ocxZpsx5tfGmFeMMeN7Hn/YGLO2Z5+5kUWeP8QY8/PoWiziBgWUSDQettZeBzwGfMkYcx3wO8A1wHJgfr4nGWPqgXVorz6pQQookWiNBo7irf5/3nrrPJYDb+f7ZmvtUWvtDODd6Joo4gYFlEg0vmGMacHrMS0EzsZboIu1dqe1VkN4Ilm0F59INP6ntfZx/xNjzGFgRM/HVwEft9Z+O67GibhIPSiReKzGG+YD76iNozG2RcRJ6kGJxGMpcIMx5jW8c49+P+b2iDhHe/GJiIiTNMQnIiJOUkCJiIiTFFAiIuIkBZSIiDhJASUiIk5SQImIiJP+P7wwWY/0Ug3WAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_decision_regions(X_train_pca, y_train, classifier=lr)\n",
    "plt.xlabel('PC 1')\n",
    "plt.ylabel('PC 2')\n",
    "plt.legend(loc='lower left')\n",
    "plt.tight_layout()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 测试数据结果"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "'c' argument looks like a single numeric RGB or RGBA sequence, which should be avoided as value-mapping will have precedence in case its length matches with 'x' & 'y'.  Please use a 2-D array with a single row if you really want to specify the same RGB or RGBA value for all points.\n",
      "'c' argument looks like a single numeric RGB or RGBA sequence, which should be avoided as value-mapping will have precedence in case its length matches with 'x' & 'y'.  Please use a 2-D array with a single row if you really want to specify the same RGB or RGBA value for all points.\n",
      "'c' argument looks like a single numeric RGB or RGBA sequence, which should be avoided as value-mapping will have precedence in case its length matches with 'x' & 'y'.  Please use a 2-D array with a single row if you really want to specify the same RGB or RGBA value for all points.\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAEYCAYAAAAJeGK1AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3dfZRV1Z3m8e8PqhAqQCFIWYBQykAAGcAG0q1i6IBGSaL4kkkbY2xpXavMMunYJtPpZcy8dTIzK9OTcbGmNWN1a8jyfdnasQwREiGxlMYXIEEGQTFMEwGLIiSUmKKkCvf8cepW3Vt1b73d836ez1ou6p6qc8/mrvI87L1/ex9zziEiIhI3I6JugIiISDEKKBERiSUFlIiIxJICSkREYkkBJSIisVQRdQN6O2vsWHfupElRN0MkdIfNGDtxFJVWGXVTREL1xo43fuucm9z7eOwC6txJk9h2991RN0MkdP+hsoJlfzaVaRXTom6KSKgWjl54oNhxDfGJiEgsKaBERCSWFFAiMbLtlX+NugkisaGAEomJb3d0Rt0EkVhRQImISCwpoEREJJYUUCIiEksKKBERiSUFlIiIxJICSkREYkkBJSIisRRKQJlZhZk9aWZbzOzBMK4pIiLJFlYP6hpgp3NuGTDFzC4I6boiiXLsqWqe2bIl6maIxEJYAbUB+F9mVgFMAN4L6boiiXLPohNRN0EkNkIJKOfc+865NmALcMQ5tz//+2ZWb2bbzGzb0fffD6NJIiISc2HNQU0yszOAi4EzzWxF/vedcw3OuaXOuaWTx44No0kiIhJzYQ3xfR34nHPuNNAGjAnpuiIiklBhBdS9wC1mthU4BmwM6boiIpJQoTzy3Tl3CFgZxrVERCQdtFBXRERiSQElIiKxpIASiaFntm+PugkikVNAicTMt+76QdRNEIkFBZSIiMRSKFV8aXDnunW0tbb2OV5VXc09a9aE3yARkZRTQA1SW2sr90+a1Of4bceORdAaEfHbrtd2s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Z6/qa2X3AwrxDU4GHgDeiaVEyFfkcm5xz3zSza4FRwMZoWpZok4DWrq/fA+ZE2JbEcs7tA9DvYnnM7AvATiK8N2YuoJxzt+e/NrNHgUuBK4A5ZvYV59zfR9K4BOn9OQKY2WrgDuAq59zp8FuVeL8Fqru+rkb7yA2bfhd9cSUwgwjvjVoH1cXMzgX+0Tl3WcRNSSQzqwWeBFY55/4QdXuSyMxuAf7EOXebma0H7nHOqXBniPS76K8o742agxK/3AxMATaa2UtdN1sZmkeAaWb2OvA7YFPE7Ukq/S6mhHpQIiISSxg0amEAAAEYSURBVOpBiYhILCmgREQklhRQIiISSwooERGJJQWUSMDM7D+b2Ztm9i9m9nMzm9p1/Ntm9krXfnHj+jm/0syeDa/FIvGggBIJx7edcxcDDwJ/aWYXAx8HLgQ2APXFTjKzMcB2tC+fZJACSiRcE4CTeKvzf+K8dR4bgLeK/bBz7qRzbiFwMLwmisSDAkokHHebWRNej2ktcDbeYlycc/udcxrCE+klc3vxiUTkvzrnHs69MLP3gLFdX/8x8KfOub+LqnEicaQelEg0tuAN84H3WI2TEbZFJJbUgxKJRiNwmZm9ivf8os9H3B6R2NFefCIiEksa4hMRkVhSQImISCwpoEREJJYUUCIiEksKKBERiSUFlIiIxNL/B2Aavd8rpTkOAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_decision_regions(X_test_pca, y_test, classifier=lr)\n",
    "plt.xlabel('PC 1')\n",
    "plt.ylabel('PC 2')\n",
    "plt.legend(loc='lower left')\n",
    "plt.tight_layout()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# LDA(Linear discriminant analysis)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## LDA实现"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 精度设置,浮点数\n",
    "np.set_printoptions(precision=4)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 平均向量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MV 1: [ 0.9066 -0.3497  0.3201 -0.7189  0.5056  0.8807  0.9589 -0.5516  0.5416\n",
      "  0.2338  0.5897  0.6563  1.2075]\n",
      "\n",
      "MV 2: [-0.8749 -0.2848 -0.3735  0.3157 -0.3848 -0.0433  0.0635 -0.0946  0.0703\n",
      " -0.8286  0.3144  0.3608 -0.7253]\n",
      "\n",
      "MV 3: [ 0.1992  0.866   0.1682  0.4148 -0.0451 -1.0286 -1.2876  0.8287 -0.7795\n",
      "  0.9649 -1.209  -1.3622 -0.4013]\n",
      "\n"
     ]
    }
   ],
   "source": [
    "# 计算每一类数据的平均向量\n",
    "mean_vecs = []\n",
    "for label in range(1, 4):\n",
    "    mean_vecs.append(np.mean(X_train_std[y_train == label], axis=0))\n",
    "    print('MV %s: %s\\n' % (label, mean_vecs[label - 1]))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 类内散度矩阵Sw"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 特征维度\n",
    "d = 13 \n",
    "S_W = np.zeros((d, d))\n",
    "# 获取每个类别的平均值向量\n",
    "for label, mv in zip(range(1, 4), mean_vecs):\n",
    "    # 每一类别的散度矩阵\n",
    "    class_scatter = np.zeros((d, d))  \n",
    "    for row in X_train_std[y_train == label]:\n",
    "        # 列向量\n",
    "        row, mv = row.reshape(d, 1), mv.reshape(d, 1) \n",
    "        class_scatter += (row - mv).dot((row - mv).T)\n",
    "    # 每个类别散度矩阵之和\n",
    "    S_W += class_scatter                         "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 类间散度矩阵SB"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 全局平均值\n",
    "mean_overall = np.mean(X_train_std, axis=0)\n",
    "# 特征维度\n",
    "d = 13  \n",
    "S_B = np.zeros((d, d))\n",
    "# 获取每个类别的平均值\n",
    "for i, mean_vec in enumerate(mean_vecs):\n",
    "    n = X_train[y_train == i + 1, :].shape[0]\n",
    "    # 列向量\n",
    "    mean_vec = mean_vec.reshape(d, 1)  \n",
    "    mean_overall = mean_overall.reshape(d, 1)  \n",
    "    # 类间散度矩阵\n",
    "    S_B += n * (mean_vec - mean_overall).dot((mean_vec - mean_overall).T)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 特征值计算"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "求解矩阵 $S_W^{-1}S_B$的特征值和特征向量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 计算LDA的特征值\n",
    "eigen_vals, eigen_vecs = np.linalg.eig(np.linalg.inv(S_W).dot(S_B))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0.0000e+00+0.0000e+00j,  4.2257e+00+0.0000e+00j,\n",
       "        8.2625e+00+0.0000e+00j, -1.2454e-15+0.0000e+00j,\n",
       "        5.3485e-16+2.0059e-16j,  5.3485e-16-2.0059e-16j,\n",
       "        2.3023e-16+2.2646e-16j,  2.3023e-16-2.2646e-16j,\n",
       "       -3.0897e-16+2.9887e-16j, -3.0897e-16-2.9887e-16j,\n",
       "       -3.4712e-18+0.0000e+00j, -2.7022e-16+0.0000e+00j,\n",
       "       -2.0974e-16+0.0000e+00j])"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eigen_vals"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 特征值分布"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "8.262493673957486\n",
      "4.225659486916685\n",
      "1.2454365753641987e-15\n",
      "5.71224762018794e-16\n",
      "5.71224762018794e-16\n",
      "4.298731032916801e-16\n",
      "4.298731032916801e-16\n",
      "3.2293605074486046e-16\n",
      "3.2293605074486046e-16\n",
      "2.702165077415812e-16\n",
      "2.0974269802096344e-16\n",
      "3.4711688834518034e-18\n",
      "0.0\n"
     ]
    }
   ],
   "source": [
    "# 创建由特征值和特征向量组成的list\n",
    "eigen_pairs = [(np.abs(eigen_vals[i]), eigen_vecs[:, i])\n",
    "               for i in range(len(eigen_vals))]\n",
    "\n",
    "# 根据特征值从大到小排序(eigenvalue, eigenvector)\n",
    "eigen_pairs = sorted(eigen_pairs, key=lambda k: k[0], reverse=True)\n",
    "\n",
    "# 特征值结果\n",
    "for eigen_val in eigen_pairs:\n",
    "    print(eigen_val[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEECAYAAADHzyg1AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAceklEQVR4nO3deZRU5b3u8e8DtDQoIGLngqCiiyiiSDStcUKgCa6YAznxqGexgkOCxgEPVzHGi9GTKHfIlaDRcxOXoiZHFOLNZBDO8ggBjEOcAMdAnIfbDqFBoekoSMPv/rGLLbTV3VVN764ufD7/8FbVu/f+VS2qnt7T+yoiMDMzA+hS6gLMzKzzcCiYmVnKoWBmZimHgpmZpRwKZmaW6lbqAoq17777xuDBg0tdhplZWVmxYsX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ndCmTZvo16+fA6GDSaJfv367tIdWyDmFp0huUhMwXNLS7S+RjJ56J/CNpstFxGZgfJOnr8jT7+IiazazMuBAKI1d/dwLOadwXERsa2bjlSSXm5qZ7dY+/DAZELqxsZHKykp69eq1W9bS6uGj5gIh99qmiHiv3aoxM+ukvva1r/HSSy8xcuRI6utbn51xy5YtrfZpSWNjIw0N+Wc6LraWYhSyp2BmVnbmzZvHjBkz6N+/P+vXr2fjxo3sv//+bNmyhQMPPJB58+YB8Mwzz3DfffcxY8aMdNlzzz2Xa665hi9+8YsALF26lNGjR7Nq1SouvfRSBg5MLpQ877zzWL16NT179vzM9rdt28bSpUt3eu6BBx5g3333pWfPnsyfP58f/OAHzda/ePFili1bxsyZM3d6vrla2otDwcx2SxUVFYwZM4ZRo0axatUqXn/9dcaPH8/GjRt57LHH0n5HHnkkF154IVOmTKF///7psjte0llTU0NNTU3ebfziF79gyJAhdOv26c/pypUrOfroo3fq+9FHHzF9+nQWLFjAwIEDmTRpEpMnT063CXDjjTeyePFi+vTpw9atW2loaGDixIl88skn9OjRg7lz5zZbS3txKJhZpq5b8BdWvdu+hziG7debH004vMU+EcGAAQMYOnQoDQ0NNDQ0MHToUNavX8+jjz6a9uvatSsPP/wwlZWVba5n5syZrFmzhhtuuIFnn32WSy65hD/96U9079497TN16lQuvfTS9Abc6dOnc84557BgwYK036ZNm5gyZQp77bUXt9xyCz/5yU9YtGgRDQ0NnH766W2urxgOBTPbLfXt25elS5fym9/8htdee41jjjmGhx9+mLq6Os4//3wA7rvvPm688UaOOOIILrroIqZMmUJFRQUvvfQSL774It27d2fixIlcfHHLF0lOnz6da6+9ljPOOIO6ujruuuuu9Id+y5YtXH755WzZsoXvfOc76TITJ07k6aefpqamhjvvvJOhQ4cSEdTX1/Pyyy/z7rvv8sQTT/DKK6/w8ccf88ILL3D44S0HYXtwKJhZplr7iz4rY8eO5aGHHuKNN97gyCOPpEePHuyxxx4MHz48/ZGfMGECp512GqNGjWLEiBHpYaXzzz+fa665hsGDBxe0rS5dujBjxgy++c1v8uGHHzJo0Kdje7711lts3ryZ6upqRowYQX19PYMHD2bDhg0ce+yxnHnmmQwYMABI9hQOOeQQxo0bx6233so999xDfX09l112GRMnTmzfD6gZzYaCpL2AXr66yMzK0fz583nnnXd45JFH6NmzJ/3792fjxo3MmTOH559/nptvvpk99khG62+Peyrmzp3L3nvvzUUXXcTXv/51Fi1aRPfu3RkyZAizZ88GoE+fPjQ2NnLeeedx3333sXr1ai677LJ0HRs3bqSqqoqbbrqJU045Ja1rzZo1u1xfoVraU6gElkq6KSJu66iCzMzaQ+/evRkxYgTDhg3jiCOO4A9/+AOTJ0+mX79+vP/++2kgbHfFFVdw7bXXstdezQ38nN/WrVu5+uqreeWVV5g7dy4VFRW8+eab3HHHHVxyySU79Z0zZw633347kAwFsv/+++/0+ptvvsnAgQN56623mDdvHqeeeirr1q3j0EPzjSeajZZCoRH4NnBYx5RiZtZ+JHH//fczceJEqqqq2HPPPenevTtXXXUVXbp04dhjj6V79+7U19fz+OOPM27cuKIDAZIT1V/60peYMWMGXbt2BeDHP/4xXbp8ehvY+vXrmTZtGscffzwHH3wwa9as4emnn+a73/1u2qexsZF169ZRUVHB3Llzqa6uplu3bqxcuTI9B9IRWjuncDOwrJU+Zmadzocffsi9997L3nvvzYQJE7jmmms46qij+O1vf8urr76anghev349l19+OVdffXW67ObNm9m8eXNzq041NjYyefJkevbsyW237XxAZdu2bcycOZPq6mq+973v8ZWvfIWLLroISEKja9euHHvssWn/X/3qV4wePZo33niDt99+m48++ohZs2Zx4oknsmTJEgYMGMCIESN2uvQ1C4poeSRqSWMiotMEQ3V1dSxfvrxNy/508cvtVse0cYe027rMdjerV6/msMM+3wcZtm3bhqSCz1e8++67dOnShSVLlvD2228zatQojj/+eFavXs2iRYv44IMPdrrBriX5Pn9JKyKiurVlCxk6u8VAkNSlpaEwzMw+j3Y8fFSI/fbbD4BJkybt9PywYcMYNmxYu9XVmoKqlnS3pMMk/XOel78k6dr2LcvMzEq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CEg6/y+7tmrXMoWCfdycB/w34ETBT0i+BA4F9JT1L8qN9GzCT5If+REm/j4h/2r4CSd0iopFkb2ADSRB8QnIX9WxgX2CrpG9ExDnbFyMZbfMQYD/gOOCLJDenDQf+kum7NmuGQ8E+7+4hGUlyK8nQC9/N/cAj6WfADcC7wALg2YhYJ2n7+D1fyB0u6i7paxHxe0mHAjNIDj3dBMyi+T2Fl0lGDb2IZFjp3sBNEXFvlm/YrCUOBfu86wH8GDiBZDjnaySNBILkL/6jSEbEfAzYPo/B9hNxa5ocPjoUuBL4J+AXuafvBfYm2VM4KyK+mXu+F1AHXAYs2mGdX2jvN2hWDIeCGfwHybmCGyX1BdZFxP/J7SnMyp1A3hdobRDAt4EJJMMTdyM5X3EucDLwd+D+HfoOJjn/cCDwLZKJf/rx6UiuZiXhULDPtYhYDayWdEXu8YeSjpDU9HJtkczKuBT4Yu6w0ZDcvz1IAmML8F9JDkU9S3KO4RZyewrAdyT9Gvgl0C8itgCTJC0HGoGjgTuyfcdmLXMomCUqJHWPiM0RcaGka4AjSQ7xAHQHukdETXMrkDQQuDAi3sg9vh04LyLebNLvbOAhSQcBBwA9gStIDlGNlfQe8Nz2cxtmHcn3KZh1MEn7AdtIJj05APgTyZVNh5FclrpPRPhmNisJh4KZmaU8zIWZmaUcCmZmlnIomJlZyqFgZmYph4KZmaX+Py2IsxUObfbzAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 实部求和\n",
    "tot = sum(eigen_vals.real)\n",
    "# 计算比例\n",
    "discr = [(i / tot) for i in sorted(eigen_vals.real, reverse=True)]\n",
    "# 累计求和\n",
    "cum_discr = np.cumsum(discr)\n",
    "\n",
    "plt.bar(range(1, 14), discr, alpha=0.5, align='center',\n",
    "        label='\"区分度\"分布')\n",
    "plt.step(range(1, 14), cum_discr, where='mid',\n",
    "         label='累计\"区分度\"')\n",
    "plt.ylabel('\"区分度\" 比例')\n",
    "plt.xlabel('特征维度')\n",
    "plt.ylim([-0.1, 1.1])\n",
    "plt.legend(loc='best')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 特征降维"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 保留两维特征\n",
    "w = np.hstack((eigen_pairs[0][1][:, np.newaxis].real,\n",
    "              eigen_pairs[1][1][:, np.newaxis].real))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[-0.1586, -0.4077],\n",
       "       [ 0.0984, -0.1821],\n",
       "       [-0.0156, -0.3473],\n",
       "       [ 0.1588,  0.3095],\n",
       "       [-0.0207, -0.064 ],\n",
       "       [ 0.1884,  0.0733],\n",
       "       [-0.7153,  0.3034],\n",
       "       [-0.0798, -0.0009],\n",
       "       [ 0.0074,  0.0716],\n",
       "       [ 0.3448, -0.2808],\n",
       "       [-0.0254,  0.244 ],\n",
       "       [-0.3192, -0.0459],\n",
       "       [-0.4054, -0.5806]])"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "w"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 特征降维\n",
    "X_train_lda = X_train_std.dot(w)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0.8944, -0.3881,  1.1007, -0.812 ,  1.132 ,  1.0981,  0.712 ,\n",
       "        0.181 ,  0.0663,  0.5129,  0.7963,  0.4483,  1.9059])"
      ]
     },
     "execution_count": 66,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 降维前\n",
    "X_test_std[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 1.2617, -0.6537])"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 降维后\n",
    "X_train_lda[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAECCAYAAADw0Rw8AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAfJUlEQVR4nO3db2xV530H8O/PxMxYwaYxiHRBxm0TVX1BQMIKYWzKkqz50wzaVEpfzK2oeGGp6WYTpmpSkWITyZvaqoCZ1hd+kYxV3lZValpI2iURSdslDXS2ZIrUqmuEMGJKM8cBQwYU7Pvbi+PDPffcc849555/zzn3+5Gu4vvvnMfX5Hee+3ue5/eIqoKIiMqrLe8GEBFRuhjoiYhKjoGeiKjkGOiJiEqOgZ6IqORuy7sBbmvXrtW+vr68m0FEVCjT09Pvq+o6r+eMC/R9fX2YmprKuxlERIUiIrN+zzF1Q0RUcgz0REQlx0BPRFRyDPRERCXHQE9EVHIM9EREJcdAT0RUcuUI9F1dgEj9rasr75YREeWuHIH+yhX/xxn4iVrW5JlJ9B3uQ9uBNvQd7sPkmcm8m5SLTFbGiogA+GcAnwTwvwA+r6qLWZy7ht8FgYhKZ/LMJAaPD+LqzasAgNmFWQweHwQADGwayLNpmcuqR78DwG2qej+ALgCPZHReImpR+0/svxXkbVdvXsX+E/tDH6Ms3wiyqnXzHoDx5Z9vuJ8UkUEAgwDQ29ubUZOIqMzOL5yP9Lhbmb4RZNKjV9XfqeovReRJACsBvOJ6fkJV+1W1f906z+JrRESR9HZ7dxr9HndL4huBKTIbjBWRXQC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kNAZ6onDmYVWxJCocBnqicO4AcDHvRhA1g4GeqIHlHPwXUC1bTFQoDPREVc+JyNTy7a+XH3sWwH8C+BdVfTXHthE1jbVuiIhKjj16IqKSY6AnIio5BnoiopJjoCciKjkGeiKikmOgJyIquf8HGs9oJ2yBZHAAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 结果绘制\n",
    "colors = ['r', 'b', 'g']\n",
    "markers = ['s', 'x', 'o']\n",
    "\n",
    "for l, c, m in zip(np.unique(y_train), colors, markers):\n",
    "    plt.scatter(X_train_lda[y_train == l, 0],\n",
    "                X_train_lda[y_train == l, 1] * (-1),\n",
    "                c=c, label=l, marker=m)\n",
    "\n",
    "plt.xlabel('LD 1')\n",
    "plt.ylabel('LD 2')\n",
    "plt.legend(loc='lower right')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 使用sklearn实现LDA并进行LR分类"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA\n",
    "# 实例化\n",
    "lda = LDA(n_components=2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 对训练数据进行LDA处理\n",
    "X_train_lda = lda.fit_transform(X_train_std, y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([2.9646, 1.157 ])"
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_train_lda[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/yaoxiaoying/.py3virtualEnv/ai/lib/python3.7/site-packages/sklearn/linear_model/logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n",
      "  FutureWarning)\n",
      "/Users/yaoxiaoying/.py3virtualEnv/ai/lib/python3.7/site-packages/sklearn/linear_model/logistic.py:469: FutureWarning: Default multi_class will be changed to 'auto' in 0.22. Specify the multi_class option to silence this warning.\n",
      "  \"this warning.\", FutureWarning)\n"
     ]
    }
   ],
   "source": [
    "# 实例化逻辑回归\n",
    "lr = LogisticRegression()\n",
    "# 训练\n",
    "lr = lr.fit(X_train_lda, y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "'c' argument looks like a single numeric RGB or RGBA sequence, which should be avoided as value-mapping will have precedence in case its length matches with 'x' & 'y'.  Please use a 2-D array with a single row if you really want to specify the same RGB or RGBA value for all points.\n",
      "'c' argument looks like a single numeric RGB or RGBA sequence, which should be avoided as value-mapping will have precedence in case its length matches with 'x' & 'y'.  Please use a 2-D array with a single row if you really want to specify the same RGB or RGBA value for all points.\n",
      "'c' argument looks like a single numeric RGB or RGBA sequence, which should be avoided as value-mapping will have precedence in case its length matches with 'x' & 'y'.  Please use a 2-D array with a single row if you really want to specify the same RGB or RGBA value for all points.\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAEYCAYAAAAJeGK1AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3dfXRW1b0n8O/OG0l4E5AYQBJM0UQzhF4ItwiIQqviiKHSIoq2UjsLetWR4pr2jnW1M9O62tU7a8bJva23cn2hVRRHoVOsV/AFNQYpGtCQ8hJRL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Bz/eCmCei21xQlD+XnVB+jdr2zNZ+W62EOIRADWGS7MAPCmlrBNCbIe2t9/brjTOBhbvdzyApwDsdadF9rJ4vw1Syp8IIW4GUABgizsts90YAKcHPz4DoNLFtthOSnkAAALw9wohxDIAzfDpv1kLY6Htt5r1Z7LyASWlvNv4ub633+CnBwFMcLxRNrJ4v89A+w3legCVQoh7pZS/caVxNjC/XwAQQtQBWAXgJinlgPOtcsQJACMHPx6JAOzZFpC/VwBYCKAMPv03a+EMgNbBj7P6TPbiEN9OADMGP064t5/XSSmXSSnnALgVwE6f/x8dQohSAD8CcKOU8qzb7bHR6wjPw8wH8IaLbbFdgP5eA/dvFjY+kz0XUNzbz/fuBDAOwJbBI1vucrtBNlkHYIIQYjeAz6EFlp8F5e81cOx8JnMnCSIiUpLnelBERBQMDCgiIlISA4qIiJTEgCIiIiUxoIhsJoT470KIOyyufSiE2CmEeDDBz+cLIV60t5VE6mFAEbnn59C2hrlFCHGj1TcIIYqgrTPx+159RFEYUEQuklJ2AVgP4JoYX++WUtYA+NTJdhGpgAFF5L5OaDuaE5EBA4rIfaMBnHS7EUSqYUARuWhwjukWhI/eIKJBDCgiZ/xcCNE0+N+9g9d+Bu1Ygj9IKV9xsW1ESuJefEREpCT2oIiISEkMKCIiUhIDioiIlMSAIiIiJTGgiIhISQwoIiJS0v8Hjl9MFv6GkzIAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 训练数据结果\n",
    "plot_decision_regions(X_train_lda, y_train, classifier=lr)\n",
    "plt.xlabel('LD 1')\n",
    "plt.ylabel('LD 2')\n",
    "plt.legend(loc='lower left')\n",
    "plt.tight_layout()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "'c' argument looks like a single numeric RGB or RGBA sequence, which should be avoided as value-mapping will have precedence in case its length matches with 'x' & 'y'.  Please use a 2-D array with a single row if you really want to specify the same RGB or RGBA value for all points.\n",
      "'c' argument looks like a single numeric RGB or RGBA sequence, which should be avoided as value-mapping will have precedence in case its length matches with 'x' & 'y'.  Please use a 2-D array with a single row if you really want to specify the same RGB or RGBA value for all points.\n",
      "'c' argument looks like a single numeric RGB or RGBA sequence, which should be avoided as value-mapping will have precedence in case its length matches with 'x' & 'y'.  Please use a 2-D array with a single row if you really want to specify the same RGB or RGBA value for all points.\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAEYCAYAAAAJeGK1AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAfOElEQVR4nO3dfZBV1Z3u8edH89IgL9od2hZsGxGmOyGAkU6C08gdiBNJYSBqqePb+FaFc40TR2uSKXUyNTfXKsubupXiJnFueoJlxuAbV+eGhBF8YUwHr1FpR6QkIF4ylAw2jRiRBFtoWPPH7iOnT58+dPc+Z++19/5+qiz77KbPXp5q98Na67fWMuecAADwzYi4GwAAQDEEFADASwQUAMBLBBQAwEsEFADASyPjbkChT40f76bV1sbdDCDR9nceU8+0Kp06fnzcTQFOattr295zzk0uvO5dQE2rrdXme+6JuxlAorXdd0Bdj56t5bNmxd0U4KTmVM/ZXew6Q3wAAC8RUEAKda06Le4mAKERUEBKMbyHpCOgAABeIqCAlLl3xvG4mwCUBQEFpNDy1ta4mwCERkABALxEQAFpsmpV3C0AyoaAAtKmujruFgBlQUABALxEQAEpcu99N9KDQmoQUEDKsEAXaUFAAQC8FGlAmdkdZvZclPcEsuLbo7w7nAAIJbKAMrNGSTdEdT8gi1q+OC3uJgBlE+VfuVZKukvSnRHesyLueOghHT54sN/1cZMm6Xs33B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EAvERAAQC8REABALxEQAEAvERAARVmZn9vZtcWufaWmXWY2T0n+flRZvbzyrYS8A8BBcTnOwq2frnCzJYW+wNmNlbBOpIs7uWHjCOggBg55w5LekzSnwzw/Y+cc3Mk7YmyXYAPCCggfgcU7HgOIA8BBcSvRtLv4m4E4BsCCohR7xzTFTpxNAeAXgQUEI3vmNnm3n9u6732dwqOHfgn59wzMbYN8BJ78QEAvEQPCgDgJQIKAOAlAgoA4CUCCgDgJQIKAOAlAgoA4KX/BJm4HZi24jH8AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 测试数据结果\n",
    "X_test_lda = lda.transform(X_test_std)\n",
    "\n",
    "plot_decision_regions(X_test_lda, y_test, classifier=lr)\n",
    "plt.xlabel('LD 1')\n",
    "plt.ylabel('LD 2')\n",
    "plt.legend(loc='lower left')\n",
    "plt.tight_layout()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# kernel PCA "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "对于线性不可分的数据,在降维时可以使用带核函数的PCA"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAboAAADNCAYAAADOp7VIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO2deZxT5dXHvyfJJDMMO4K4ASqKC+KGu3XBfa2ite67tsVaW6v1rb5WrdVWa+uudSmvS1FbKyquiIq7QKEKooiIIKKAIMgMs2Q97x/PhMlkbmaSmcm9N5nn+/nkM8m9z01O5iY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fna6uV5yMdGv3yn87TVF5/pQv5n+X5GS9rRiUgVMIs26gCWGHnXNywlyvA8AewDhFR1T6A3cKjH9uRDKdXPzNdWL89DPjb65Tudjx1++Uzn9T8r5DNa0o5OVRtUdRSw1GtbuohC6huWDGV4ngBWYGpMAsS8NKQASql+Zr62enke8rHRL9/pfOzwy2c63/9Z3p9R30+3ZOJQD/AtVb3SK3uKwADyqG9o8R5VXQAgIscDYWCytxa1ppj1M7uajtrq8XnI5/vql+90u3b46DPdrq2FfkZLytGp6jivbSgyq8ivvqHFB4jIscAlwDGqmvTanmyyvy8iMoH862cOAQ4DRojIz1X1rqIZSqds9fI85PN99ct3Oi87fPKZzsfWgj6jJT11WYa8RvO8+Bhgqoe2WNpARAYDlwNHqWqt1/bkSV6fL1U9tamw9MnArGI7uRzkZavH5yEfG/3ynW7XDh99ptu1tdDPqHV0/mICsElTfcPVmBNu8SdnARsBk0XknaYizH6n1edLRDYXkVs8tsuJfG318jxk27jQwT6/fKfzsdUvn+l8bC0ImzBusVgslrLGRnQWi8ViKWuso7NYLBZLWWMdncVisVjKGuvoLBaLxVLWWEdnsVgsBSIi14rIfBF5T0SmisjGInK9iExvqhPZq2lcWdV4LVWso7NYLJaOcb2q7g2Mx0jifwDsCbwMXFimNV5LEuvoLBaLpXP0BQ4AXlSTr/Uy8FmZ1ngtSUqqBJjFYrH4iKtE5ELgK+AhTHIzqvoF8IWHdlmysBGdxWKxdIwbVHU/VT0NWAn0BBCR3UXkcm9Ns2RiHZ3FYrF0nncxBYbBtJVp8NAWSxZ26tJisVg6zyTgYBGZgenrdrLH9lgysLUuLRaLxVLW2KlLi8VisZQ11tFZLBaLpayxjs5isVgsZY11dBaLxWIpa6yjs1gsFktZYx2dxWKxWMoa6+gsFovFUtb8Pyh/6U3gch1lAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x216 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from sklearn.decomposition import KernelPCA\n",
    "from sklearn.datasets import make_moons\n",
    "# 数据生成\n",
    "X, y = make_moons(n_samples=100, random_state=123)\n",
    "# 实例化\n",
    "scikit_kpca = KernelPCA(n_components=2, kernel='rbf', gamma=15)\n",
    "# 数据处理\n",
    "X_skernpca = scikit_kpca.fit_transform(X)\n",
    "# 结果绘制\n",
    "fig, ax = plt.subplots(nrows=1, ncols=2, figsize=(7, 3))\n",
    "ax[0].scatter(X[:,0],X[:,1],marker='o',c=y) \n",
    "\n",
    "ax[1].scatter(X_skernpca[y == 0, 0], X_skernpca[y == 0, 1],\n",
    "            color='red', marker='^', alpha=0.5)\n",
    "ax[1].scatter(X_skernpca[y == 1, 0], X_skernpca[y == 1, 1],\n",
    "            color='blue', marker='o', alpha=0.5)\n",
    "\n",
    "plt.xlabel('PC1')\n",
    "plt.ylabel('PC2')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "274px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
